package com.kawaiior.asoulworld.property.Properties;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.event.entity.living.LivingHurtEvent;

public class PropertyHemo extends PropertyBase implements Iproperty {

    private float [] levelOfValue = new float[]{0.05f, 0.1f, 0.2f};

    public PropertyHemo(int level) {
        super(level);
    }

    @Override
    public void doProperty(LivingHurtEvent event) {
        if (!(event.getSource().getTrueSource() instanceof EntityPlayer)) { return; }
        EntityPlayer player = (EntityPlayer)event.getSource().getTrueSource();
        float f = event.getAmount() > event.getEntityLiving().getHealth() ? event.getEntityLiving().getHealth() : event.getAmount();
        player.heal(f*levelOfValue[this.getLevel()]);
    }

    @Override
    public String getPropertyString() {
        return "property_hemo";
    }

}
